﻿/**
 * 
 * @file FITKSEASubSysCavity.h
 * @brief 声腔子系统声明
 * @author LiBaojun (libaojunqd@foxmail.com)
 * @date 2024-11-04
 * 
 */
#ifndef _FITK_ACOUSTOCS_SEA_CAVITY__H___
#define _FITK_ACOUSTOCS_SEA_CAVITY__H___
 
#include "FITKAbstractSEASubSys.h"

namespace Acoustics
{
    class FITKAbstractSEAFace;
    class FITKAbstractSEASubSysShell;
    class FITKAcousticsAbsMaterial;
    class FITKAcousticsAbstractSpectra;
     /**
      * @brief 声腔子系统
      * @author LiBaojun (libaojunqd@foxmail.com)
      * @date 2024-11-04
      */
    class FITKAcousticsModelAPI FITKSEASubSysCavity :
        public FITKAbstractSEASubSys
    {
        FITKCLASS(Acoustics, FITKSEASubSysCavity);
    public:
        /**
         * @brief Construct a new FITKSEASubSysCavity object
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        explicit FITKSEASubSysCavity() = default;
        /**
         * @brief Destroy the FITKSEASubSysCavity object
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        virtual ~FITKSEASubSysCavity();
        /**
         * @brief 获取子系统类型
         * @return SEASubSysType
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        virtual FITKAbstractSEASubSys::SEASubSysType getSEASubSysType() override;
        /**
         * @brief 追加shell
         * @param[i]  shellID        shellID
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        void appendShell(const int shellID);
        /**
         * @brief 移除板
         * @param[i]  shellID       板id
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        void removeShell (const int shellID, const bool& removeFace = false);
        /**
         * @brief 获取板的个数
         * @return int 
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        int getShellCount() const;
        /**
         * @brief 获取板id
         * @param[i]  index          板索引
         * @return int 
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        int getShellID(const int index);
        /**
         * @brief 获取板对象
         * @param[i]  index      第index个索引
         * @return FITKAbstractSEASubSysShell* 
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        FITKAbstractSEASubSysShell* getShell(const int index);
        /**
         * @brief 获取板索引
         * @param[i]  id     板id
         * @return FITKAbstractSEASubSysShell*
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        int getShellIndex(const int id);

        /**
         * @brief 移除FlatPlatFace
         * @param[i]         face id
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        void removeFace(const int faceID);
        /**
         * @brief 获取板基础对象的个数
         * @return int
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        int getFaceCount() const;
        /**
         * @brief 获取板基础对象id
         * @param[i]  index          索引
         * @return int
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        int getFaceID(const int index) const;
        /**
         * @brief 获取板基础对象
         * @param[i]  index      第index个索引
         * @return FITKAbstractSEAFace*
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        FITKAbstractSEAFace* getFace(const int index) const;
        /**
         * @brief 追加face，会同步追加板
         * @param[i]  faceID         面对象ID
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-08
         */
        void addFace(const int faceID);
        /**
         * @brief 获取节点ID列表
         * @return QList<int>
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-08
         */
        virtual QList<int> getNodeIDs() const override;
        /**
        * @brief 是否包含点
        * @param[i] id 节点ID
        * @return bool
        * @author LiBaojun (libaojunqd@foxmail.com)
        * @date 2024-11-14
        */
        bool isContainsNode(const int id) const override;
        /**
         * @brief    设置重载体积，没有重载不需要调用该函数
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        void setVolume(int volume);
        /**
         * @brief    设置重载面积，没有重载不需要调用该函数
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        void setSurfaceArea(int surfaceArea);
        /**
         * @brief    设置重载周长，没有重载不需要调用该函数
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        void setPerimeter(int perimeter);
        /**
         * @brief    获取是否是Override
         * @param[i] type 1：体积 2：表面积 3：周长
         * @return   bool
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        bool isOverride(int type);
        /**
         * @brief    获取体积
         * @return   double
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        double getVolume();
        /**
         * @brief    获取表面积
         * @return   double
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        double getSurfaceArea();
        /**
         * @brief    获取周长
         * @return   double
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        double getPerimeter();
        /**
         * @brief    设置阻尼ID 
         * @param[i] ID 如果 使用噪音控制处理的吸收 类型，则id = -1
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-14
         */
        void setDampingID(int id);
        /*
         * @brief 获取阻尼ID 如果id<0：使用噪音控制处理的吸收类型 Noise Control Treatments; 如果id>0 : 使用频谱类型
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-14
         */
        int getDampingID();
        /**
         * @brief    获取阻尼设置的频谱对象
         * @return   FITKAcousticsAbstractSpectra *
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-14
         */
        FITKAcousticsAbstractSpectra* getDampingSpectra();
        /**
         * @brief    获取阻尼类型
         * @return   int 频谱类型：Acoustics::FITKAcousticsAbstractSpectra::AcousticsSpectraType 
         *               使用噪音控制处理的吸收类型：-1
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-14
         */
        int getDampingType();
        /*
         * @brief 设置重载后的模态密度ID
         * @author wangning (2185896382@qq.com)
         * @date 2024-11-11
         */
        void setModalDensity(int ID);
        /*
         * @brief 获取模态密度ID,如果值为-1说明没有启用重载
         * @author wangning (2185896382@qq.com)
         * @date 2024-11-11
         */
        int getModalDensity();
        /*
         * @brief 设置启用或关闭压力，默认启用
         * @author wangning (2185896382@qq.com)
         * @date 2024-11-11
         */
        void setInSEAMatrixSolution(bool is);
        /*
         * @brief 获取压力启用状态
         * @author wangning (2185896382@qq.com)
         * @date 2024-11-11
         */
        bool getInSEAMatrixSolution();

        /**
         * @brief 更新局部坐标系
         * @return bool
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-13
         */
        virtual bool updateCoordinate() override;
        /**
         * @brief    是否是封闭空间
         * @return   bool
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-15
         */
        bool isEnclosedSpace();

    private:
        /**
         * @brief 板ID列表
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        QList<int> _shellIDList{};
        /**
         * @brief Face列表
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-11-04
         */
        QList<int> _faceIDList{};
        /**
         * @brief 重载后的体积面积周长 [0]体积 [1]面积 [2]所有板周长
         * @author wangning (2185896382@qq.com)
         * @date 2024-11-11
         */
        double _v_a_p[3]{-1, -1, -1};
        /**
         * @brief 阻尼ID 
         * 阻尼损耗系数   (Acoustics::FITKAcousticsAbstractSpectra::Damping) 损耗因子谱
         * -1,使用噪音控制处理的吸收   Noise Control Treatments   该类型没有ID
         * 平均吸收       (Acoustics::FITKAcousticsAbstractSpectra::Absorption) 吸声系数谱
         * @author wangning (2185896382@qq.com)
         * @date 2024-11-11
         */
        int _dampingID{0};
        /**
         * @brief 模态密度ID,如果为-1则没有重载
         * @author wangning (2185896382@qq.com)
         * @date 2024-11-11
         */
        int _modalDensity{ -1 };
        /**
         * @brief 压力启用状态，默认启用
         * @author wangning (2185896382@qq.com)
         * @date 2024-11-11
         */
        bool _inSEAMatrixSolution{true};
    };    
}
#endif
